package com.dinglian.ots.dao.mapper;

import com.dinglian.ots.dao.model.Cart;
import com.dinglian.ots.dao.model.CartExample;
import java.util.List;
import java.util.Map;

import com.dinglian.ots.vo.cart.BrandCartVo;
import com.dinglian.ots.vo.cart.DeleteCartVo;
import com.dinglian.ots.vo.cart.UpdateCartVo;
import com.dinglian.ots.vo.order.OrderVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

public interface CartMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int countByExample(CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int deleteByExample(CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int insert(Cart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int insertSelective(Cart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    List<Cart> selectByExampleWithRowbounds(CartExample example, RowBounds rowBounds);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    List<Cart> selectByExample(CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    Cart selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") Cart record, @Param("example") CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") Cart record, @Param("example") CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(Cart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ots_cart
     *
     * @mbggenerated
     */
    int updateByPrimaryKey(Cart record);


    /**
     * 获取购物车中品牌信息
     * @param userId
     * @return
     */
    List<BrandCartVo> getBrandCart(@Param("userId") Integer userId);

    /**
     * 获取购物车中产品信息
     * @param userId
     * @param brandId
     * @return
     */
    List<Map> getProductCart(@Param("userId") Integer userId,@Param("brandId") Integer brandId);

    /**
     * 更新购物车
     * @param cartVo
     */
    void updateCart(@Param("vo") UpdateCartVo cartVo);

    /**
     * 删除购物车
     * @param cartVo
     */
    void deleteCart(@Param("vo") DeleteCartVo cartVo);

    /**
     * 查询购物车中选中的商品
     * @param orderVo
     * @return
     */
    List<Cart> selectCartInfo(@Param("orderVo") OrderVo orderVo);

    /**
     * 修改购物车之后返回总金额
     * @param userId
     * @param skuId
     * @return
     */
    Map getProductTotal(@Param("userId") Integer userId,@Param("skuId") Integer skuId);

    /**
     * 获取购物车总量
     * @param productIdList
     * @param userId
     * @return
     */
    List<Map> getCartTotal(@Param("products") List<Integer> productIdList, @Param("userId") Integer userId);

    /**
     * 根据sku获取产品
     * @param userId
     * @param skuId
     * @return
     */
    Map getProductBySku(@Param("userId") Integer userId,@Param("skuId") Integer skuId);

    /**
     * 获取品牌购物车汇总
     * @param userId
     * @param brandId
     * @return
     */
    Map getBrandCartTotal(@Param("userId") Integer userId,@Param("brandId") Integer brandId);

    /**
     * 查询产品总量
     * @param userId
     * @param skuId
     * @return
     */
    Map getProductTotalBySkuId(@Param("userId") Integer userId, @Param("skuId") Integer skuId);


    /**
     * 获取购物车单色的总定量
     * @param productId
     * @return
     */
    Integer getAllTotalQty(@Param("productId") Integer productId,@Param("userId")Integer userId);
}